<template>
    <div class="box">
        <div class="title">
            <p>未来七天游客趋势图</p>
            <img src="@/assets/screen/dataScreen-title.png" alt="">
        </div>
        <div class="charts" ref="line"></div>
    </div>
</template>

<script setup lang='ts'>
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'

const line = ref()

onMounted(() => {
    const mycharts = echarts.init(line.value)
    mycharts.setOption({
        xAxis: {
            type: 'category',
            boundaryGap: false,
            splitLine:{
                show:false
            },
            data:['周一','周二','周三','周四','周五','周六','周日','周一','周二','周三','周四','周五','周六','周日','周一','周二','周三','周四','周五','周六'],
            
        },
        yAxis: {
            splitLine:{
                show:false
            },
            axisLine:{
                show:true
            },
            axisTick:{
                show:true
            }
        },
        grid: {
            top: 0,
            left: 40,
            right: 20,
            bottom: 20
        },
        series: [{
            type: 'line',
            data: [120, 2240, 4402, 1210, 4212, 3210, 414, 6245, 3161, 4623, 2326, 3221, 3424, 1234,3210, 414, 6245, 3161, 4623, 414, 6245, 3161, 4623, 2326,],
            smooth: true,
            areaStyle: {
                color: {
                    type: 'linear',
                    x: 0.2,
                    y: 0.1,
                    x2: 0.8,
                    y2: 0.9,
                    colorStops: [{
                        offset: 0, color: '#007afe' // 0% 处的颜色
                    }, {
                        offset: 1, color: '#11144e' // 100% 处的颜色
                    }],
                    global: false // 缺省为 false
                }
            }
        }]
    })
})
</script>

<style scoped lang="scss">
.box {
    width: 100%;
    height: 100%;
    background: url(@/assets/screen/dataScreen-main-cb.png) no-repeat;
    background-size: 100% 100%;
    margin: 0 20px;
    margin-bottom:10px;

    .title {
        p {
            color: white;
            font-size: 20px
        }
    }

    .charts {
        height: calc(100% - 40px);
    }
}
</style>